<template>
  <div class="top-bar">
    <div style="background-color: rgb(78, 78, 78);height: 30px;width: 30px;margin: 0 10px;">
      <ClockComponent :size="30"></ClockComponent>
    </div>
    <span style="color:white;font-size: medium;">VR云印空间B端管理界面</span>
    <el-dropdown style="margin-left: auto;">
      <i class="el-icon-setting" style="margin-left: auto;color:white;"></i>
      <el-dropdown-menu slot="dropdown">
        <el-dropdown-item icon="el-icon-error" @click.native="exitLogin">退出登录</el-dropdown-item>
      </el-dropdown-menu>
    </el-dropdown>
    <div style="background-color: whitesmoke; height: 30px;width: 30px;
    border-radius: 50%;margin:0 10px;"></div>
    <div style="color:white;font-size: medium;margin-right: 20px;">{{ username }}</div>

  </div>
</template>

<script>
import ClockComponent from './ClockComponent.vue';

export default {
  components:{
    ClockComponent
  },
  data(){
    return{
      username:this.$store.state.USERNAME
    }
  },
  methods:{
    exitLogin(){
      console.log('退出登录')
      this.$store.commit('deleteToken')
      this.$router.replace('/login')
    }
  }
};
</script>

<style scoped>
.top-bar {
    height: 40px;
    top: 0;
    left:0;
    width: 100%;
    display: flex;
    align-items: center;
    position: fixed;
    background-color: #545c64;
    z-index: 5;
}
</style>